
function tologin() {
    var url="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxcb7ee578b56be1c3&redirect_uri=http%3A%2F%2Fserver.tpp.isartop.com%2Fapi%2Fuser%2Fwaplogin"+encodeURIComponent("?wap_from="+curl)+"&response_type=code&scope=snsapi_userinfo&state=64db04c0973989358b79ac18b472f7fb&connect_redirect=1#wechat_redirect";
    topage(url)
}
function toreg() {
    topage('/pages/user/reg.html')
}
function toast(message, time) {
    if (time == null) {
        time = 3000
    }
    $("#toast").show()
    $("#toast").html(message)
    $("#toast").addClass("animated bounceInUp")

    setTimeout(function () {
        $("#toast").addClass("animated bounceOutUp")
    }, time)
    setTimeout(function () {
        $("#toast").removeClass('animated bounceInUp bounceOutUp');
        $("#toast").hide()
    }, time + 1000);
}

function topage(link,time) {
    if(time!=null){
        setTimeout(" window.location.href = '"+link+"'",time)
    }else{
        window.location.href = link
    }
}
function autosetdata(data) {
    for(var key in data){
        $("#"+key).html(data[key])
    }
}

function toprice(price){
    return parseInt(price*100)/100;
}